package mtyan;

public class Events {
	
	public void add(Event event){
		MySQLConnector connector = new MySQLConnector();
		String update = String.format("INSERT INTO Event (subject,description,begin,end) VALUES ('%s','%s','%s','%s')", event.getSubject(),event.getDescription(),event.getBegin(),event.getEnd());
		connector.executeUpdate(update);
		String eventId = connector.executeSimpleQuery("id", "event", "ORDER BY id DESC LIMIT 1");
		for (int i=0;i<event.getParticipants().length;i++){
			update = String.format("INSERT INTO event_user VALUES('%s','%s')", eventId, event.getParticipants()[i]);
			connector.executeUpdate(update);
		}
	}
	
	public void addComment(Comment comment){
		MySQLConnector connector = new MySQLConnector() ;
	}
	
}
